<?php
namespace app\api\validate;
use think\Validate;

/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/7/21 0021
 * Time: 14:35
 */
class Login extends Validate
{
    protected $rule = [
        'tel' => ['require','/^1[34578]\d{9}$/','unique:iuser'],
        'username' => 'require',
        'password' => 'alphaNum|require|length:5,15',
    ];
    protected $message = [
        'tel.require' => '手机号码必填',
        'tel.unique' => '手机号码已被注册',
        'tel' => '手机格式不正确',
        'username'=>'姓名不能为空',
        'password.alphaNum' => '必须为字母加英文',
        'password.require' => '密码不能为空',
        'password.length' => '密码长度只能在6-15之间',
    ];
    protected $scene = [
        'login' => ['tel'=>['/^1[34578]\d{9}$/','require'],'password'],
        'tel' => ['tel'=>['/^1[34578]\d{9}$/','require']],
        'registe' => ['tel','password'],
    ];
}